﻿var setting = {
    data: {
        simpleData: {
            enable: true
        }
    },
    view: {
        expandSpeed: "slow" //节点展开加载速度 可以填充的值为：fast、slow、normal 表示动画时长的毫秒数值 (如：1000) 设置为"",表示不显示动画效果
    },
    callback: {
        onClick: zTreeOnClick
    }
};

function zTreeOnClick(event, treeId, treeNode) {
    parent.window.location.href = "GiveAuthorization.html?Id=" + treeNode.id;
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
};

$(document).ready(function () {
    //初始化zTree 获取几个父节点
    $.ajax({
        type: "POST",
        url: "/Role/GetRole.html",
        success: function (data) {
            if (data != null) {
                var json = eval("(" + data + ")");
                $.fn.zTree.init($("#treeDemo"), setting, json);
            }
        }
    })
});